home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / t_unix / j109lxa4.tar / rip.h < prev    next >
C/C++ Source or Header  |  1994-06-04  |  4KB  |  125 lines

  1. #ifndef _RIP_H
  2. #define _RIP_H
  3.  
  4. /* Routing Information Protocol (RIP)
  5.  *
  6.  *      This code is derived from the 4.2 BSD version which was
  7.  * used as a spec since no formal specification is known to exist.
  8.  * See RFC 1009, Gateway Requirements, for more details. AGB 4-29-88
  9.  *
  10.  * The draft RIP RFC was used to develop most of this code. The above
  11.  * referred to the basics of the rip_recv() function of RIP.C. The RIP
  12.  * RFC has now been issued as RFC1058. AGB 7-23-88
  13.  *
  14.  * Substantially rewritten and integrated into NOS 9/1989 by KA9Q
  15.  *
  16.  * Mods by PA0GRI
  17.  */
  18. #ifndef _MBUF_H
  19. #include "mbuf.h"
  20. #endif
  21.  
  22. #ifndef _IFACE_H
  23. #include "iface.h"
  24. #endif
  25.  
  26. #ifndef _UDP_H
  27. #include "udp.h"
  28. #endif
  29.  
  30. #define RIP_INFINITY    16
  31. #define RIP_TTL         240     /* Default time-to-live for an entry */
  32. #define RIPVERSION      1
  33. #define RIP_IPFAM       2
  34.  
  35. /* UDP Port for RIP */
  36. #define RIP_PORT        520
  37.  
  38. /* RIP Packet Types */
  39. #define RIPCMD_REQUEST          1       /* want info */
  40. #define RIPCMD_RESPONSE         2       /* responding to request */
  41. #define RIPCMD_MAX              3
  42.  
  43. #define HOPCNT_INFINITY         16      /* per Xerox NS */
  44. #define MAXRIPROUTES            25      /* maximum # routes per RIP pkt */
  45.  
  46. struct rip_list {
  47.     struct rip_list *prev;
  48.     struct rip_list *next;  /* doubly linked list */
  49.  
  50.     /* address to scream at periodically:
  51.      * this address must have a direct network interface route and an
  52.      * ARP entry for the appropriate  hardware broadcast address, if approp.
  53.      */
  54.     int32 dest;
  55.  
  56.     /* basic rate of RIP clocks on this net interface */
  57.     int32 interval;
  58.  
  59.     struct timer rip_time;  /* time to output next on this net. iface */
  60.  
  61.     /* the interface to transmit on  and receive from */
  62.     struct iface *iface;
  63.  
  64.     /* described below with the mask defs */
  65.     char    flags;
  66. #define RIP_SPLIT 0x1   /* Do split horizon processing */
  67. #define RIP_US  0x2     /* Include ourselves in the list */
  68. };
  69. #define NULLRL  (struct rip_list *)0
  70.  
  71. /* Host format of a single entry in a RIP response packet */    
  72. struct rip_route {
  73.     int16   addr_fam;
  74.     int32   target;
  75.     int32   metric;
  76. };
  77. #define RIPROUTE        20      /* Size of each routing entry */
  78. #define RIPHEADER       4       /* Size of rip header before routes */
  79. #define MAXRIPPACKET    RIPHEADER + (MAXRIPROUTES*RIPROUTE)
  80.  
  81. /* RIP statistics counters */
  82. struct rip_stat {
  83.     int32 output;           /* Packets sent */
  84.     int32 rcvd;             /* Packets received */
  85.     int32 request;          /* Number of request packets received */
  86.     int32 response;         /* Number of responses received */
  87.     int32 unknown;          /* Number of unknown command pkts received */
  88.     int32 version;          /* Number of version errors */
  89.     int32 addr_family;      /* Number of address family errors */
  90.     int32 refusals;         /* Number of packets dropped from a host
  91.                     on the refuse list */
  92. };
  93.  
  94. struct rip_refuse {
  95.     struct rip_refuse *prev;
  96.     struct rip_refuse *next;
  97.     int32   target;
  98. };
  99. #define NULLREF (struct rip_refuse *)0
  100.  
  101. /* RIP primitives */
  102. int rip_init __ARGS((void));
  103. void rt_timeout __ARGS((void *s));
  104. void rip_trigger __ARGS((void));
  105. int rip_add __ARGS((int32 dest,int32 interval,char flags));
  106. int riprefadd __ARGS((int32 gateway));
  107. int riprefdrop __ARGS((int32 gateway));
  108. int ripreq __ARGS((int32 dest,int16 replyport));
  109. int rip_drop __ARGS((int32 dest));
  110. int nbits __ARGS((int32 target));
  111. void pullentry __ARGS((struct rip_route *ep,struct mbuf **bpp));
  112. void rip_shout __ARGS((void *p));
  113.  
  114. /* RIP Definition */
  115. extern int16 Rip_trace;
  116. extern int Rip_merge;
  117. extern int32 Rip_ttl;
  118. extern struct rip_stat Rip_stat;
  119. extern struct rip_list *Rip_list;
  120. extern struct rip_refuse *Rip_refuse;
  121. extern struct udp_cb *Rip_cb;
  122.  
  123. #endif  /* _RIP_H */
  124.  
  125.